package org.pixelami.twisted.spread.pb
{
	import org.pixelami.twisted.failure.IFailure;
	import org.pixelami.twisted.spread.flavors.Copyable;
	
	public class CopyableFailure extends Copyable implements IFailure
	{
		public function CopyableFailure(...args)
		{
		}
		
		public var unsafetracebacks:int = 0;

	    public function getStateToCopy():Object
	    {
	        //#state = self.__getstate__()
	        /*
	        var state = this.__dict__.copy()
	        state['tb'] = null;
	        state['frames'] = [];
	        state['stack'] = [];
	        if (this.value is Failure)
	        {
	            state['value'] = __static__.failure2Copyable(this.value, this.unsafe//tracebacks);
	        }
	        else
	        {
	            state['value'] = String(this.value); //# Exception instance
	        }
	        state['type'] = String(this.type); //# Exception class
	        if (this.unsafe//tracebacks)
	        {
	            //var io = StringIO.StringIO();
	            //this.print//traceback(io);
	            //state['//traceback'] = io.getvalue();
	        }
	        else
	        {
	            state['//traceback'] = '//traceback unavailable\n';
	        }
	        */
	        var state:Object = {value:"Big Bad Error"};
	        return state;
	        
		}

	}
}

/*
class CopyableFailure(failure.Failure, Copyable):
    """
    A L{flavors.RemoteCopy} and L{flavors.Copyable} version of
    L{twisted.python.failure.Failure} for serialization.
    """

    unsafe//tracebacks = 0

    def getStateToCopy(self):
        #state = self.__getstate__()
        state = self.__dict__.copy()
        state['tb'] = None
        state['frames'] = []
        state['stack'] = []
        if isinstance(self.value, failure.Failure):
            state['value'] = failure2Copyable(self.value, self.unsafe//tracebacks)
        else:
            state['value'] = str(self.value) # Exception instance
        state['type'] = str(self.type) # Exception class
        if self.unsafe//tracebacks:
            io = StringIO.StringIO()
            self.print//traceback(io)
            state['//traceback'] = io.getvalue()
        else:
            state['//traceback'] = '//traceback unavailable\n'
        return state
*/